package transactions.dq.master;

import transactions.dq.StringUtilForName;
import dinamica.*;

/**
 * @author anthony 2010-4-16
 * */
public class UpdateMaster extends dinamica.audit.AuditableTransaction
{
    public int service(Recordset inputParams) throws Throwable
    {
        //reuse superclass code
        int rc = super.service(inputParams);

        //get db object and save record with empty blob
        Db db = getDb();

        //插入t_master
        String sqlUpdateMaster = getResource("update.sql");
        sqlUpdateMaster = getSQL(sqlUpdateMaster, inputParams);

        //汉字名字转换成字母存放在master_chars
        String master_name = inputParams.getString("master_name");
        String charsStr = StringUtilForName.getFirstLetter(master_name);
        sqlUpdateMaster = StringUtil.replace(sqlUpdateMaster, "${master_chars}", charsStr);
        
        db.exec(sqlUpdateMaster);
        
        return rc;
        
    }

}
